package com.demo.service;

import com.demo.dao.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService3 {
    private UserRepository userRepository;

    //2、set注入
    @Autowired
    public void setUserRepository(UserRepository userRepository){
        this.userRepository=userRepository;
    }

    public void sayHi(){
        System.out.println("Do UserService3 sayHi!!!");
        userRepository.add();
    }
}
